#include "OriRspHeaderRecvHandler.h"
#include "BeginRedirectOriConnHandler.h"
#include "OriRspHeaderSendHandler.h"
#include "HttpResponseHeader.h"
#include "GlobalContext.h"

using namespace log4cplus;

Logger OriRspHeaderRecvHandler::log=GetLogger(LOG4CPLUS_TEXT("OriRspHeaderRecvHandler"));

void OriRspHeaderRecvHandler::GetRecvInfo(ClientContext &client,SOCKET *recvSock,WSABUF **recvBuffer,OVERLAPPED **recvOvl,HttpResponseHeader **responseHeader)
{
	unsigned int clienSequenceNo=client.SequenceNo();
	*recvSock=client.DestSock();
	*recvBuffer=client.Buffer();
	*recvOvl=client.OVL();
	*responseHeader=&(client.HttpResponseHeaderData());
	LOG4CPLUS_DEBUG_FMT(log,LOG4CPLUS_TEXT("[Client%d]Set original server's response header recvsend info."),clienSequenceNo);
}

ITransHandler::ExecuteResultCode OriRspHeaderRecvHandler::OnExecuteError(ClientContext &client,OVERLAPPED *ovl,ITransHandler::ExecuteResultCode executeResult)
{
	return executeResult;
}

ITransHandler* OriRspHeaderRecvHandler::GetNextHandler()
{
	return new OriRspHeaderSendHandler();
}